﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
    public class KaoHeModel
    {
        private int _Sec;
        [DataMember]
        public int Sec
        {
            get { return _Sec; }
            set { _Sec = value; }
        }
        private int _ID;
        [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }
        private int _EmpbasicID;
        [DataMember]
        public int EmpbasicID
        {
            get { return _EmpbasicID; }
            set { _EmpbasicID = value; }
        }

        private string _Status;
        [DataMember]
        public string Status
        {
            get { return _Status; }
            set { _Status = value; }
        }

        private string _RenZhiStatus;
        [DataMember]
        public string RenZhiStatus
        {
            get { return _RenZhiStatus; }
            set { _RenZhiStatus = value; }
        }

        private string _KeShi;
        [DataMember]
        public string KeShi
        {
            get { return _KeShi; }
            set { _KeShi = value; }
        }

        private string _ZhiWei;
        [DataMember]
        public string ZhiWei
        {
            get { return _ZhiWei; }
            set { _ZhiWei = value; }
        }

        private int _OrgID;
        [DataMember]
        public int OrgID
        {
            get { return _OrgID; }
            set { _OrgID = value; }
        }

        private string _NianShu;
        [DataMember]
        public string NianShu
        {
            get { return _NianShu; }
            set { _NianShu = value; }
        }

        private string _Name;
        [DataMember]
        public string Name
        {
            get { return _Name; }
            set { _Name = value; }
        }

        private string _OrgName;
        [DataMember]
        public string OrgName
        {
            get { return _OrgName; }
            set { _OrgName = value; }
        }

        private string _OldKeShi;
        [DataMember]
        public string OldKeShi
        {
            get { return _OldKeShi; }
            set { _OldKeShi = value; }
        }

        private string _OldZhiWei;
        [DataMember]
        public string OldZhiWei
        {
            get { return _OldZhiWei; }
            set { _OldZhiWei = value; }
        }

        private string _ZhiWuShuXing;
        [DataMember]
        public string ZhiWuShuXing
        {
            get { return _ZhiWuShuXing; }
            set { _ZhiWuShuXing = value; }
        }

        private string _ZhiWuCengCi;
        [DataMember]
        public string ZhiWuCengCi
        {
            get { return _ZhiWuCengCi; }
            set { _ZhiWuCengCi = value; }
        }

        private DateTime? _RZQMSJ;
        [DataMember]
        public DateTime? RZQMSJ
        {
            get { return _RZQMSJ; }
            set { _RZQMSJ = value; }
        }
        private string _StatusString;
        [DataMember]
        public string StatusString
        {
            get { return _StatusString; }
            set { _StatusString = value; }
        }
        private int _TotalCount = 0;
        [DataMember]
        public int TotalCount
        {
            get { return _TotalCount; }
            set { _TotalCount = value; }
        }
        private int _Realcount = 0;
        [DataMember]
        public int Realcount
        {
            get { return _Realcount; }
            set { _Realcount = value; }
        }
        private int _YouXiu = 0;
        [DataMember]
        public int YouXiu
        {
            get { return _YouXiu; }
            set { _YouXiu = value; }
        }
        private int _ChenZhi = 0;
        [DataMember]
        public int ChenZhi
        {
            get { return _ChenZhi; }
            set { _ChenZhi = value; }
        }
        private int _BuChenZhi = 0;
        [DataMember]
        public int BuChenZhi
        {
            get { return _BuChenZhi; }
            set { _BuChenZhi = value; }
        }
        private int _QiQuan = 0;
        [DataMember]
        public int QiQuan
        {
            get { return _QiQuan; }
            set { _QiQuan = value; }
        }

        private decimal? _UnAgreeRate = 0;
        [DataMember]
        public decimal? UnAgreeRate
        {
            get { return _UnAgreeRate; }
            set { _UnAgreeRate = value; }
        }

        private DateTime? _Begindate;
        [DataMember]
        public DateTime? Begindate
        {
            get { return _Begindate; }
            set { _Begindate = value; }
        }

        private DateTime? _Enddate;
        [DataMember]
        public DateTime? Enddate
        {
            get { return _Enddate; }
            set { _Enddate = value; }
        }

        private DateTime? _HuiYiDate;
        [DataMember]
        public DateTime? HuiYiDate
        {
            get { return _HuiYiDate; }
            set { _HuiYiDate = value; }
        }
        private string _NewZhiWuShuXing;
        [DataMember]
        public string NewZhiWuShuXing
        {
            get { return _NewZhiWuShuXing; }
            set { _NewZhiWuShuXing = value; }
        }
        private ObservableCollection<KaoHe_AttatchmentModel> _Attachment = new ObservableCollection<KaoHe_AttatchmentModel>();

        [DataMember]
        public ObservableCollection<KaoHe_AttatchmentModel> Attachment
        {
            get { return _Attachment; }
            set { _Attachment = value; }
        }
        private DateTime? _JobDate = null;
        [DataMember]
        public DateTime? JobDate
        {
            get { return _JobDate; }
            set { _JobDate = value; }
        }

        private DateTime? _RXRZWSXSJ = null;
        [DataMember]
        public DateTime? RXRZWSXSJ
        {
            get { return _RXRZWSXSJ; }
            set { _RXRZWSXSJ = value; }
        }
        private string _ServiceMode;
        [DataMember]
        public string ServiceMode
        {
            get { return _ServiceMode; }
            set { _ServiceMode = value; }
        }
        public static KaoHeModel FillEntity(DataRow dr)
        {
            KaoHeModel right = new KaoHeModel();
            if (dr.Table != null && dr.Table.Columns.Contains("EmpbasicID")) right.EmpbasicID = Convert.ToInt32(dr["EmpbasicID"]);
            if (dr.Table != null && dr.Table.Columns.Contains("ID")) right.ID = Convert.ToInt32(dr["ID"]);
            if (dr.Table != null && dr.Table.Columns.Contains("Status")) if (!string.IsNullOrEmpty(dr["Status"].ToString())) right.Status = dr["Status"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("RenZhiStatus")) if (!string.IsNullOrEmpty(dr["RenZhiStatus"].ToString())) right.RenZhiStatus = dr["RenZhiStatus"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("KeShi")) if (!string.IsNullOrEmpty(dr["KeShi"].ToString())) right.KeShi = dr["KeShi"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("ZhiWei")) if (!string.IsNullOrEmpty(dr["ZhiWei"].ToString())) right.ZhiWei = dr["ZhiWei"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("OrgID")) right.OrgID = Convert.ToInt32(dr["OrgID"]);
            if (dr.Table != null && dr.Table.Columns.Contains("NianShu")) if (!string.IsNullOrEmpty(dr["NianShu"].ToString())) right.NianShu = dr["NianShu"].ToString();

            if (dr.Table != null && dr.Table.Columns.Contains("Name")) if (!string.IsNullOrEmpty(dr["Name"].ToString())) right.Name = dr["Name"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("OrgName")) if (!string.IsNullOrEmpty(dr["OrgName"].ToString())) right.OrgName = dr["OrgName"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("OldKeShi")) if (!string.IsNullOrEmpty(dr["OldKeShi"].ToString())) right.OldKeShi = dr["OldKeShi"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("OldZhiWei")) if (!string.IsNullOrEmpty(dr["OldZhiWei"].ToString())) right.OldZhiWei = dr["OldZhiWei"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("ZhiWuShuXing")) if (!string.IsNullOrEmpty(dr["ZhiWuShuXing"].ToString())) right.ZhiWuShuXing = dr["ZhiWuShuXing"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("ZhiWuCengCi")) if (!string.IsNullOrEmpty(dr["ZhiWuCengCi"].ToString())) right.ZhiWuCengCi = dr["ZhiWuCengCi"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("RZQMSJ")) if (!string.IsNullOrEmpty(dr["RZQMSJ"].ToString()) && Convert.ToDateTime(dr["RZQMSJ"]) != Convert.ToDateTime("1900-01-01")) right.RZQMSJ = Convert.ToDateTime(dr["RZQMSJ"]);

            if (dr.Table != null && dr.Table.Columns.Contains("TotalCount")) if (!string.IsNullOrEmpty(dr["TotalCount"].ToString())) right.TotalCount = Convert.ToInt32(dr["TotalCount"]);
            if (dr.Table != null && dr.Table.Columns.Contains("Realcount")) if (!string.IsNullOrEmpty(dr["Realcount"].ToString())) right.Realcount = Convert.ToInt32(dr["Realcount"]);
            if (dr.Table != null && dr.Table.Columns.Contains("YouXiu")) if (!string.IsNullOrEmpty(dr["YouXiu"].ToString())) right.YouXiu = Convert.ToInt32(dr["YouXiu"]);
            if (dr.Table != null && dr.Table.Columns.Contains("ChenZhi")) if (!string.IsNullOrEmpty(dr["ChenZhi"].ToString())) right.ChenZhi = Convert.ToInt32(dr["ChenZhi"]);
            if (dr.Table != null && dr.Table.Columns.Contains("BuChenZhi")) if (!string.IsNullOrEmpty(dr["BuChenZhi"].ToString())) right.BuChenZhi = Convert.ToInt32(dr["BuChenZhi"]);
            if (dr.Table != null && dr.Table.Columns.Contains("QiQuan")) if (!string.IsNullOrEmpty(dr["QiQuan"].ToString())) right.QiQuan = Convert.ToInt32(dr["QiQuan"]);
            if (dr.Table != null && dr.Table.Columns.Contains("UnAgreeRate")) if (!string.IsNullOrEmpty(dr["UnAgreeRate"].ToString()) ) right.UnAgreeRate = Convert.ToDecimal(dr["UnAgreeRate"].ToString());

            if (dr.Table != null && dr.Table.Columns.Contains("Begindate")) if (!string.IsNullOrEmpty(dr["Begindate"].ToString()) && Convert.ToDateTime(dr["Begindate"]) != Convert.ToDateTime("1900-01-01")) right.Begindate = Convert.ToDateTime(dr["Begindate"]);
            if (dr.Table != null && dr.Table.Columns.Contains("Enddate")) if (!string.IsNullOrEmpty(dr["Enddate"].ToString()) && Convert.ToDateTime(dr["Enddate"]) != Convert.ToDateTime("1900-01-01")) right.Enddate = Convert.ToDateTime(dr["Enddate"]);
            if (dr.Table != null && dr.Table.Columns.Contains("HuiYiDate")) if (!string.IsNullOrEmpty(dr["HuiYiDate"].ToString()) && Convert.ToDateTime(dr["HuiYiDate"]) != Convert.ToDateTime("1900-01-01")) right.HuiYiDate = Convert.ToDateTime(dr["HuiYiDate"]);

            if (dr.Table != null && dr.Table.Columns.Contains("JobDate")) if (!string.IsNullOrEmpty(dr["JobDate"].ToString()) && Convert.ToDateTime(dr["JobDate"]) != Convert.ToDateTime("1900-01-01")) right.JobDate = Convert.ToDateTime(dr["JobDate"]);
            if (dr.Table != null && dr.Table.Columns.Contains("RXRZWSXSJ")) if (!string.IsNullOrEmpty(dr["RXRZWSXSJ"].ToString()) && Convert.ToDateTime(dr["RXRZWSXSJ"]) != Convert.ToDateTime("1900-01-01")) right.RXRZWSXSJ = Convert.ToDateTime(dr["RXRZWSXSJ"]);
            if (dr.Table != null && dr.Table.Columns.Contains("NewZhiWuShuXing")) if (!string.IsNullOrEmpty(dr["NewZhiWuShuXing"].ToString())) right.NewZhiWuShuXing = dr["NewZhiWuShuXing"].ToString();
            return right;
        }
    }
}
